Skip to content

Add OutputContainer.add_mux_stream() for codec-context-free streams#2184

Merged
WyattBlue merged 1 commit intomainfrom
patch
Mar 10, 2026
Merged

Add OutputContainer.add_mux_stream() for codec-context-free streams#2184
WyattBlue merged 1 commit intomainfrom
patch

Conversation

@WyattBlue
Copy link
Member

Adds add_mux_stream(codec_name, rate=None, **kwargs) to OutputContainer, allowing users to create a stream with only codecpar set (codec id, type, width, height, sample_rate) and no CodecContext. This is useful when muxing pre-encoded packets from an external source where no encoding or decoding is needed, separating the muxer role from the encoder role.

Also relaxes start_encoding() to allow any stream type without a codec context (previously only data/attachment streams were permitted), and guards VideoStream/AudioStream repr and __getattr__ against codec_context=None.

Two missing fields (AVMediaType type on AVCodecDescriptor, and width, height, sample_rate on AVCodecParameters) are added to the pxd declarations so they can be accessed from Cython.

Closes #1970

Adds `add_mux_stream(codec_name, rate=None, **kwargs)` to `OutputContainer`,
allowing users to create a stream with only `codecpar` set (codec id, type,
width, height, sample_rate) and no `CodecContext`. This is useful when muxing
pre-encoded packets from an external source where no encoding or decoding is
needed, separating the muxer role from the encoder role.

Also relaxes `start_encoding()` to allow any stream type without a codec
context (previously only data/attachment streams were permitted), and guards
`VideoStream`/`AudioStream` repr and `__getattr__` against `codec_context=None`.

Two missing fields (`AVMediaType type` on `AVCodecDescriptor`, and `width`,
`height`, `sample_rate` on `AVCodecParameters`) are added to the pxd
declarations so they can be accessed from Cython.

Closes #1970

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@WyattBlue WyattBlue merged commit ad89f03 into main Mar 10, 2026
6 checks passed
@WyattBlue WyattBlue deleted the patch branch March 10, 2026 06:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

add stream without CodexContext

1 participant